package com.bluesky.service.shardUpload;

import com.baomidou.mybatisplus.extension.service.IService;
import com.bluesky.dto.shardUpload.ShardUploadCompleteRequest;
import com.bluesky.dto.shardUpload.ShardUploadDetailResponse;
import com.bluesky.dto.shardUpload.ShardUploadInitRequest;
import com.bluesky.dto.shardUpload.ShardUploadPartRequest;
import com.bluesky.po.shardUpload.ShardUploadPO;

import java.io.IOException;

/**
 * 分片上传服务
 */

public interface ShardUploadService extends IService<ShardUploadPO> {

    /**
     * 初始化分片上传
     * @param request
     * @return
     */
    String init(ShardUploadInitRequest request);

    /**
     * 上传分片
     * @param request
     * @throws IOException
     */
    void  uploadPart(ShardUploadPartRequest request) throws IOException;

    /**
     * 完成分片上传，合并分片文件
     * @param request
     * @throws IOException
     */
    void  complete(ShardUploadCompleteRequest request) throws IOException;

    /**
     * 获取分片任务详细信息
     * @param shardUploadId 分片任务id
     * @return
     */
    ShardUploadDetailResponse detail(String shardUploadId);
}
